package com.zw.weiyi.avtivity;

import java.util.ArrayList;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.zw.weiyi.enety.Person;
import com.zw.weiyi.phonesms.BaseActivity;
import com.zw.weiyi.phonesms.R;
import com.zw.weiyi.util.MessageUtil;

public class InfoSMSActivity extends BaseActivity {
	private TextView info_num;
	private ImageView finsh;
	private Button sendsms;
	private EditText smssend;
	private Person person;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.info_person_sms);
		initview();
	}

	public void initview() {
		person = new Person();

		Intent intent = this.getIntent();
		person.setName(intent.getStringExtra("name"));
		person.setPhoneNumber(intent.getStringExtra("number"));

		info_num = (TextView) findViewById(R.id.info_num);
		finsh = (ImageView) findViewById(R.id.finsh);
		smssend = (EditText) findViewById(R.id.smssend);
		sendsms = (Button) findViewById(R.id.sendsms);

		info_num.setText("接收人:     " + person.getName());
		
		// 发信息
		sendsms.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String txt1 = person.getPhoneNumber();// 号码转换成字符
				String connt = smssend.getText().toString().trim();// 获取短信内容
				MessageUtil.sendMessage(getApplicationContext(), txt1, connt);
			}
		});
		// 返回
		finsh.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}
}
